import { Controller, Get, Query } from '@nestjs/common';
import { CommService } from './comm.service';
import { SendCodeDto } from './dto/comm.dto';

@Controller('comm')
export class CommController {
  constructor(private readonly commService: CommService) { }
  /**
   * ? 发送验证码
   * ! 该接口为公共接口，无需登录
   * * 请求体为email-邮箱和type-类型
   */
  @Get('/send_code')
  sendCode(@Query() body: SendCodeDto) {
    const { email, type } = body;

    // 校验通过，发送验证码
    return this.commService.sendEmail(body);
  }
}
